package com.langsin.crmpro.dao;

import java.util.List;

import org.hibernate.Query;

import com.langsin.crmpro.base.BaseDao;
import com.langsin.crmpro.model.SDictionaryClass;

public class DictionaryDaoImpl extends BaseDao implements DictionaryDAO{

	public SDictionaryClass getDictionaryByCode(String code) {
		String queryString = "from SDictionaryClass as d where d.code=?";
		Query queryObject = getSession().createQuery(queryString);
		int i = 0;
		queryObject.setParameter(i++, code);
		List list = queryObject.list();
		if(list != null && list.size() > 0){
			return (SDictionaryClass)list.get(0);
		}
		return null;
	}
}
